﻿using System.Numerics;
// using System.Text.RegularExpressions; <- 这个肯定更爽，但我太菜了配不出
/// <summary>
/// https://leetcode-cn.com/problems/valid-number/
/// </summary>
public class Solution
{
    public bool IsNumber(string s)
    {
        var st = s.Split('e', 'E');
        if (st.Length == 1)
            return double.TryParse(st[0], out var val) && !double.IsInfinity(val);
        if (st.Length == 2)
            return double.TryParse(st[0], out var val) && !double.IsInfinity(val) && BigInteger.TryParse(st[1], out _);
        return false;
    }
}